package com.lantosec.hmrp.modules.category.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.category.vo.AssetsDirectoryVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 资产目录 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-03-31
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AssetsDirectory extends BaseEntity<AssetsDirectoryVO> {

    private static final long serialVersionUID = 1L;
    public AssetsDirectory(AssetsDirectoryVO vo){
        this.dirId = vo.getDirId();
        this.assetsName = vo.getAssetsName();
        this.categoryId = vo.getCategoryId();
        this.lableType = vo.getLableType();
        this.manualFlag = vo.getManualFlag();
        this.specification = vo.getSpecification();
        this.unit = vo.getUnit();
        this.price = vo.getPrice();
        this.supplierCode = vo.getSupplierCode();
        this.supplier = vo.getSupplier();
        this.factoryCode = vo.getFactoryCode();
        this.factory = vo.getFactory();
        this.createTime = vo.getCreateTime();
        this.createUserId = vo.getCreateUserId();
        this.createUser = vo.getCreateUser();
        this.editorTime = vo.getEditorTime();
        this.editorUserId = vo.getEditorUserId();
        this.editorUser = vo.getEditorUser();
        this.categoryName = vo.getCategoryName();
    }

    @Override
    public AssetsDirectoryVO convertToVO(){
        return new AssetsDirectoryVO(this);
    }


    /**
     * 目录ID(his目录直接取，手工录入格式：LTxxxx)
     */
    @TableId(value = "dir_id", type = IdType.ASSIGN_UUID)
    private String dirId;

    /**
     * 资产名称
     */
    private String assetsName;

    /**
     * 资产类别
     */
    private String categoryId;

    /**
     * 资产类别名称
     */
    @TableField(exist = false)
    private String categoryName;

    /**
     * 标签材质(0无标签 1普通RFID 2抗金属RFID)
     */
    private Integer lableType;

    /**
     * 是否手工录入(0 否,来自his目录；1 是)
     */
    private Integer manualFlag;

    /**
     * 规格型号
     */
    private String specification;

    /**
     * 计量单位
     */
    private String unit;

    /**
     * 资产原价(购买价格)
     */
    private BigDecimal price;

    /**
     * 供应商编码
     */
    private String supplierCode;

    /**
     * 供应商名称
     */
    private String supplier;

    /**
     * 生产厂家编码
     */
    private String factoryCode;

    /**
     * 生产厂家名称
     */
    private String factory;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建人ID
     */
    private String createUserId;

    /**
     * 创建人
     */
    private String createUser;

    /**
     * 最后编辑时间
     */
    private Date editorTime;

    /**
     * 最后编辑人ID
     */
    private String editorUserId;

    /**
     * 最后编辑人
     */
    private String editorUser;


    public enum ColName {
        dir_id, assets_name, category_id, lable_type, manual_flag, specification, unit, price, supplier_code, supplier, factory_code, factory, create_time, create_user_id, create_user, editor_time, editor_user_id, editor_user, 
    }
}
